<?php
/**
 * Created by PhpStorm.
 * User: hui
 * Date: 2017/2/18
 * Time: 16:55
 */
namespace app\api\controller;

abstract class Base
{
    protected function getData($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
        return json_decode($output, 1);
    }

    protected function getWeb($name)
    {
        $website = db('website_url')
            ->cache(true,60)
            ->where('name',$name)
            ->find();
        return $website;
    }

    abstract public function select($type);
}